//
//  Protocol.swift
//  HuaYun
//
//  Created by enghou on 2018/6/27.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

import Foundation

enum NetMethod {
    case post
    case get
    case upload
}

protocol NetProtocol{
    
//    var netConfigs: Array<Dictionary<String,Any>> {get}
    
    func reset()->Void
    
    var names: Array<String> {get}
    
    func failBlock(for name: String) -> NetFail
    
    func success(for name: String) -> NetSuccess
    
    func param(for name: String) -> Dictionary<String,Any>
    
    func path(for name: String) -> String
    
    func load(with name: String) -> Void //自定义加载数据
    
    func method(for name: String) -> NetMethod
    
    //响应接口的有效性策略,如果参数不合格，则默认根据String提示
    func strategy(for name: String) -> (Bool,String?,(()->Void)?)
    //netConfig 是一个数组，数组每一个对象是一个配置的json,该json包括name,path,param,suc,fail
    
}

protocol DataModel {
    
    var height: CGFloat {get}
    
}

protocol RefreshedTableViewProtocol: UITableViewDelegate,UITableViewDataSource,beginRefresh {
    
    var source: Array<JSON> {get set} //数据源
    
    var totalCount: Int {get set} //用来提示全部数据到底有多少条，进而可以显示没有更多数据并且当没有更多数据时不再请求网络
    
    var page: Int {get set}
}

